package com.example.aerospacemanagementsystem.controller.personnel;

import com.example.aerospacemanagementsystem.entity.personnel.Partymember;
import com.example.aerospacemanagementsystem.service.personnelService.PartymemberService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 吴欣悦
 */

@Api(tags = "党员")
@RestController
@CrossOrigin
@RequestMapping("/partymember")
public class PartymemberController {
    @Autowired
    private PartymemberService partymemberService;
    //添加党员
    @PostMapping
    public int add(@RequestBody Partymember partymember){
        return partymemberService.add(partymember);
    }
    //删除党员
    @DeleteMapping
    public int delete(Partymember partymember){
        return partymemberService.delete(partymember);
    }
    //修改党员
    @PutMapping
    public int update(@RequestBody Partymember partymember){
        return partymemberService.update(partymember);
    }
    //获取党员
    @GetMapping("/getAll")
    public List<Partymember> getAllCity(Partymember partymember) {
        List<Partymember> list = partymemberService.getAllPartymember(partymember);
        return list;
    }
}
